package JDBC;

import java.sql.Connection;
import java.sql.SQLException;



import util.ConnectionFactory;

import DAO.AdvogadoDAO;
import DAO.ClienteDAO;
import DAO.DAOFactory;
import DAO.UsuarioDAO;

public class JdbcDAOFactory extends DAOFactory {

	
	private Connection connection;
	
	public JdbcDAOFactory(){
		try {
			this.connection = ConnectionFactory.getConnection();
		} catch (SQLException e) {
			
			e.printStackTrace();
		}
	}
	
	public void closeConnection() {
		try {
			if (this.connection != null) {
				this.connection.close();
			}
		} catch (Exception e) {}
	}
	
	public UsuarioDAO getUsuarioDAO() {
		return new JdbcUsuarioDAO(this.connection);
	}
	
	public ClienteDAO getClienteDAO(){
		return new JdbcClienteDAO(this.connection);
	}
	
	public AdvogadoDAO getAdvogadoDAO(){
		return new JdbcAdvogadoDAO(this.connection);
	}
	
}
